<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>HTTP请求</title>
    <script src="../js/axios.min.js"></script>
</head>
<form action="http://127.0.0.1" method="post">
    用户名:<input name="name"><br>
    密码:<input name="pwd"><br>
    <button>登录</button>
</form>
<hr>
<form action="http://127.0.0.1" method="post" enctype="multipart/form-data">
    用户名:<input name="name"><br>
    密码:<input name="pwd"><br>
    头像:<input name="file" type="file"><br>
    <button>注册</button>
</form>
<hr>
<button onclick="get()">axios get</button>
<button onclick="post1()">axios post1</button>
<button onclick="post2()">axios post2</button>

<script>
    function get(){
        axios.get("https://127.0.0.1",{
            params : {
                name : "root",
                pwd : "123"
            }
        });
    }

    function post1(){
        let p = new URLSearchParams();
        p.append("name","root");
        p.append("pwd","456");
        axios.post("http://127.0.0.1",p);
    }

    function post2(){
        let param = {
            name : "root",
            pwd : "789"
        }
        axios.post("http://127.0.0.1",param);
    }
</script>


<body>

</body>
</html>